home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
tde40.zip
/
tdestr.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-05
|
31KB
|
912 lines
/*
* New editor name: tde, the Thomson-Davis Editor.
* Author: Frank Davis
* Date: June 5, 1991
*
* This modification of Douglas Thomson's code is released into the
* public domain, Frank Davis. You may distribute it freely.
*
* This file contains define's and structure declarations common to all
* editor modules. It should be included in every source code module.
*
* I'm so stupid, I can't keep up with which declarations are in which
* file. I decided to put all typedefs, structs, and defines in one file.
* If I don't, I end up defining a typedef one way in one file and a
* completely different way in another file.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#if !defined( __UNIX__ )
#if defined( __MSC__ )
#include <malloc.h> /* for memory allocation */
#if defined( toupper )
#undef toupper
#endif
#else
#include <alloc.h> /* for memory allocation */
#endif
#endif
/*
* in unix (POSIX?), getch( ) is in the curses package. in Linux, ncurses
* seems to be the best of the worst curses.
*/
#if defined(__UNIX__)
#include <dirent.h> /* walking down directories */
#include <limits.h> /* NAME_MAX and PATH_MAX, POSIX stuff */
#include <malloc.h> /* for memory allocation */
#include <ncurses.h>
#include <unistd.h> /* chdir, getcwd, etc... */
#include <sys/types.h>
#include <sys/stat.h>
#else
#include <conio.h>
#endif
#include "bj_ctype.h"
#include "letters.h"
/*
* defines for the inline assembler.
*/
#if defined( __MSC__ )
#define ASSEMBLE _asm
#else
#define ASSEMBLE asm
#endif
#if defined( __UNIX__ )
#define FAR
#define my_stdprn stderr
#else
#define FAR far
#define my_stdprn stdprn
#endif
/*
* based on code contributed by "The Big Boss" <intruder@link.hacktic.nl>
* let's look for a config file in the current directory or in the user's
* home directory.
*/
#if defined( __UNIX__ )
# define CONFIGFILE ".tdecfg"
#endif
/*
* based on code by chen.
* in both DOS and UNIX, let's assume the biggest screen is 132x60.
*/
#define MAX_COLS 132 /* screen can be 132 columns in UNIX */
#define MAX_LINES 60 /* highest screen ever used */
#define BUFF_SIZE 1042 /* buffer size for lines */
#define MAX_LINE_LENGTH 1040 /* longest line allowed in file */
#define FNAME_LENGTH 45 /* maximum file name length in lite bar */
#define NO_MARKERS 3 /* maximum no. of markers */
#define UNDO_STACK_LEN 200 /* number of lines in undo stack */
/*
* when we read in a file, lets try to match the size of the read buffer
* with some multiple of a hardware or software cache that may be present.
*/
#define READ_LENGTH 1024
#define DEFAULT_BIN_LENGTH 64
#define REGX_SIZE 200 /* maximum number of nodes in nfa */
/*
* general defines.
*/
#ifndef ERROR
# define ERROR (-1) /* abnormal termination */
#endif
#ifndef OK
# define OK 0 /* normal termination */
#endif
#ifndef TRUE
# define TRUE 1 /* logical true */
#endif
#ifndef FALSE
# define FALSE 0 /* logical false */
#endif
#define MAX_KEYS 256 /* number of special keys recognized by TDE */
#define AVAIL_KEYS 233 /* number of special keys recognized by TDE */
#define MAX_TWO_KEYS 128 /* number of two key-combos allowed by TDE */
#define STROKE_LIMIT 1024 /* number of key strokes in playback buffer */
#if defined( __UNIX__ )
#define MAX_CURSES_KEYS 153 /* number of keys in ncurses */
#endif
#define STACK_UNDERFLOW 1 /* code for underflowing macro stack */
#define STACK_OVERFLOW 2 /* code for overflowing macro stack */
#define SAS_P 20 /* number of sas pointers to tokens */
#define NUM_FUNCS 143
#define NUM_COLORS 14 /* number of color fields in TDE */
/*
* special cases for keyboard mapping - see bottom of main.c
*/
#define RTURN 262 /* Return key = 262 */
#define ESC 258 /* Escape key = 258 */
#define CONTROL_BREAK 269 /* Control-Break = 269 */
/*
* The following defines are used by the "error" function to indicate
* how serious the error is.
*/
#define WARNING 1 /* user must acknowledge, editor continues */
#define FATAL 2 /* editor aborts - very rare! */
#define INFO 3 /* display message, acknowledge, continue */
/*
* define the type of block marked by user and block actions
*/
#define NOTMARKED 0 /* block type undefined */
#define BOX 1 /* block marked by row and column */
#define LINE 2 /* block marked by begin and end lines */
#define STREAM 3 /* block marked by begin and end characters */
#define MOVE 1
#define DELETE 2
#define COPY 3
#define KOPY 4
#define FILL 5
#define OVERLAY 6
#define NUMBER 7
#define SWAP 8
#define LEFT 1
#define RIGHT 2
#define ASCENDING 1
#define DESCENDING 2
/*
* three types of ways to update windows
*/
#define LOCAL 1
#define NOT_LOCAL 2
#define GLOBAL 3
#define CURLINE 1
#define NOTCURLINE 2
/*
* search/replace flags.
*/
#define BOYER_MOORE 0
#define REG_EXPRESSION 1
#define CLR_SEARCH 0
#define WRAPPED 1
#define SEARCHING 2
#define REPLACING 3
#define NFA_GAVE_UP 4
#define IGNORE 1
#define MATCH 2
#define PROMPT 1
#define NOPROMPT 2
#define FORWARD 1
#define BACKWARD 2
#define BEGIN 1
#define END 2
#define BEGINNING 1
#define CURRENT 2
/*
* word wrap flag.
*/
#define NO_WRAP 0
#define FIXED_WRAP 1
#define DYNAMIC_WRAP 2
/*
* date and time formats
*/
#define MM_DD_YY 0
#define DD_MM_YY 1
#define YY_MM_DD 2
#define MM_DD_YYYY 3
#define DD_MM_YYYY 4
#define YYYY_MM_DD 5
#define _12_HOUR 0
#define _24_HOUR 1
/*
* used in interrupt 0x21 function xx for checking file status
*/
#define EXIST 0
#define WRITE 2
#define READ 4
#define READ_WRITE 6
#define NORMAL 0x00
#define READ_ONLY 0x01
#define HIDDEN 0x02
#define SYSTEM 0x04
#define VOLUME_LABEL 0x08
#define SUBDIRECTORY 0x10
#define ARCHIVE 0x20
/*
* critical error def's
*/
#define RETRY 1
#define ABORT 2
#define FAIL 3
/*
* flags used for opening files to write either in binary or text mode.
* crlf is for writing files in text mode - Operating System converts
* lf to crlf automatically on output. in binary mode, lf is not translated.
*/
#define NATIVE 1
#define CRLF 2
#define LF 3
#define BINARY 4
#define TEXT 5
#define OVERWRITE 1
#define APPEND 2
/*
* characters used in tdeasm.c to display eol and column pointer in ruler
*/
/*
#if defined( __UNIX__ )
#define EOL_CHAR 0x1c
#define RULER_PTR 0x21
#define RULER_FILL 0x2e
#define RULER_TICK 0x2b
#define LM_CHAR 0x6c
#define RM_CHAR_RAG 0x3c
#define RM_CHAR_JUS 0x7c
#define PGR_CHAR 0x70
#define VERTICAL_CHAR 0x7c
#else
#define EOL_CHAR 0x11
#define RULER_PTR 0x19
#define RULER_FILL 0x2e
#define RULER_TICK 0x04
#define LM_CHAR 0xb4
#define RM_CHAR_RAG 0x3c
#define RM_CHAR_JUS 0xc3
#define PGR_CHAR 0x14
#define VERTICAL_CHAR 0xba
#endif
*/
/*
* cursor size
*/
#define SMALL_INS 0
#define BIG_INS 1
#define CURSES_INVISBL 0
#define CURSES_SMALL 1
#define CURSES_LARGE 2
/*
* possible answers to various questions - see get_yn, get_ynaq and get_oa
*/
#define A_YES 1
#define A_NO 2
#define A_ALWAYS 3
#define A_QUIT 4
#define A_ABORT